Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wip/bewest/dev #19

Merged
merged 20 commits into from
Aug 25, 2023
Merged

Wip/bewest/dev #19

merged 20 commits into from
Aug 25, 2023

Conversation

bewest
Copy link
Member

@bewest bewest commented Aug 14, 2023

Dev Branch Nightscout Connect

  • sundry fixes
  • Libre
    • version update, Libre 3
    • Libre works 👍
  • Glooko remaining issues?
  • Dexcom server name update.
  • Medtronic

Minimed Carelink Updates

  • robust to more errors
  • include some pump and treatment events
  • more sensitive to UA string

AndyLow91 and others added 10 commits August 7, 2023 17:19
fixed path for trace-axios dependency
Bug found - "var connections = resp.data.data;"
This was not a bug afterall, reverting.
Typo found in "opts.linkUpPatientId;"
Align treatments syncing to last glucose for first pass.
bewest added 2 commits August 14, 2023 13:07
In order to share this interface, between external and sidecars, it needs to
standardize on being a real date object when present.
This prevents a category of errors the plugin is running internally to
Nightscout but has no recent information to generate a reasonable last known
basis.
This allows minimed to sync treatments data specifically on last treatment data
when syncing from within Nightscout.

There is a potential issue with using 0 as the default here, as this could
create issues duplicating and syncing the largest amount of data that the
driver may allow.
@bewest
Copy link
Member Author

bewest commented Aug 14, 2023

Much of the logic here was borrowed from here:
https://github.com/stijnbrouwers/minimed-connect-to-nightscout/blob/feature/treatments-38/transform.js

A few things to note: several items with different types share the same index in the markers array. When this is true, this plugin will create a combined meal entry. Secondly, with the BLE_X device family, the timezone is errantly applied by Medtronic to be described as Z, or +00:00, indicating that the time is in zulu/GMT time. However, the conduit device timestamp has the correct zoning information which must be reapplied to each relevant timezone. Curiously, this is not true with the device family is just GUARDIAN, in which case timezones are correctly applied and should not be touched. 🤷

bewest and others added 4 commits August 14, 2023 13:39
Force Medtronic to log requests from nightscout-connect.
Do not allow plausible deniability.
Per nightscout/minimed-connect-to-nightscout#46, force
putting a second UUID in a header.  x-axios-tracing already sets a UUID.
This patch correctly uses browser based headers for processing and requesting
HTML Forms.
@bewest
Copy link
Member Author

bewest commented Aug 21, 2023

@AndyLow91, I've adjusted to correctly use the browser string for URLs truly expecting a browser. The Nightscout Connect attribution is also included in the browser UA string. Finally, an extra UUID was added based on feedback from nightscout/minimed-connect-to-nightscout#46. Instead of doing the latter, it may prove better to generate 6 - 8 random characters and append that instead.

@bewest
Copy link
Member Author

bewest commented Aug 22, 2023

Note, the Medtronic implementation does not implement the refresh logic. I'm not sure how the refresh logic is supposed to work, but it could play a role in reducing the need to overflow the rate on calling consent method, as it's probably expected to refresh in production.

When it's possible to log in, fetching valid data should result in inserting
new data to Nightscout.  This patch adds needed control flow (returning a
promise), as well as corrects datetime handling in order to allow inserting
missing information into Nightscout.
If the word Nightscout is present in the UA string, Medtronic EU servers will block the request.
This patch moves the software attribution information to the x-powered-by
header.
@bewest
Copy link
Member Author

bewest commented Aug 24, 2023

  • Medtronic
  • Libre
  • Dexcom
  • Glooko - what is latest with Glooko?
  • Nightscout - glucose only

x-axios-tracing already implements a uuid in that header, making this one
redundant.  This patch removes the x-uniq-req header, which does nothing but
otherwise complicate the code.
@sbc2280
Copy link

sbc2280 commented Aug 24, 2023

Steps to get this working? #3

I think this may work for refresh token

https://github.com/anguriskit24/CareLinkJavaClient/tree/feature/get-new-auth-token

@bewest
Copy link
Member Author

bewest commented Aug 24, 2023

Ah, I see they add the locale and country query parameters, same as the log in requires. I will try this out.

This patch refreshes existing Carelink session when possible, instead of always
creating new sessions.
Thanks @sbc2280 for the tip:
https://github.com/anguriskit24/CareLinkJavaClient/blob/22defbd961a5092c7ed40f3f64adc0170928df39/src/main/java/info/nightscout/medtronic/carelink/client/CareLinkClient.java#L308-L310

Refreshing the Carelink session involves using the right content-type, as well
as adding the relevant locale and country query parameters.
@bewest
Copy link
Member Author

bewest commented Aug 24, 2023

Thanks, @sbc2280. I don't know why, but refreshing the session is so much more satisfying than creating a new one.

  • Medtronic Carelink session refresh 🧾

@bewest bewest merged commit 3f9ed7a into main Aug 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants